/**
 * 仪表台面板
 */

import { Component, OnInit } from '@angular/core';
import { Hero } from './app.hero';
import { HeroService } from './hero.service';

@Component({
    selector: 'app-dashboard',
    templateUrl: 'dashboard.component.html',
    styleUrls: ['./app.component.css']
})
export class DashboardComponent implements OnInit {

    heroes: Hero[];
    shero: Hero;

    constructor(private heroService: HeroService) {

    }
    ngOnInit() {
        this.heroService.getHeroes().then((heroes) => {
            this.heroes = heroes.slice(1, 5);
        });
    }

    onSelect(hero: Hero) {
        this.shero = hero;
    }

}

